package com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.factory;

import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Color;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Rectangle;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Shape;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.Square;
import com.example.design.shejimoshi.createMode.factoryMode.抽象工厂模式.factory.AbstractFactory;

/**
 * 专门生产Shape的工厂
 */
public class ShapeFactory extends AbstractFactory {
    @Override
    public Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        } else if (shapeType.equalsIgnoreCase("SQUARE")) {
            return new Square();
        }
        return null;
    }

    @Override
    public Color getColor(String color) {
        return null;
    }
}